<template class="defTemp">
  <div class="page">
    <nuxt/> <!-- 内容主体 -->
  </div>
</template>
<script>
import axios from 'axios';

import { MessageBox } from 'mint-ui';

const { config } = window;

export default {
  head: {
    title: sessionStorage.getItem('hosName') || '欢迎光临',
    meta: [
      { 'http-equiv': 'Content-Type', content: 'text/html;charset=UTF-8' },
      { 'http-equiv': 'refresh', content: '5000' },
      { name: 'viewport', content: 'viewport-fit-cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' }, // 点击可以放大缩小<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=yes" />

    ],
    link: [
      /* { rel: 'stylesheet', href: '//at.alicdn.com/t/font_820838_8zk89op7ed5.css' }, 小杜的ICON */
      { rel: 'stylesheet', href: '//at.alicdn.com/t/font_864836_7iwpkmqk4u9.css' },
    ],
    script: [
    ],
  },
  data() {
    return {
      hospitalDomain: '',
    };
  },
  created() {
    
  },
  mounted() {
    // window.document.title = `${sessionStorage.getItem('hosName')}`;
  },
  methods: {
    getHospitalInfoDev() {
      console.log('===============================1111111111111111111111111');
      axios.post(`${config.APIRootDev}/doctor/WeixinLogin.lg?reqType=OBTAIN&RYBID=${config.APIAPPID}&DATA=${config.APIRootDevDomainName}`).then((response) => {
        if (response.data.RESULT == '514' || response.data.RESULT == '515' || response.data.RESULT == '516') {
          this.$messagebox('提示', `${response.data.RESULTTEXT}`);
        }
        this.$store.commit('setHospitalName', response.data.hosName);
        this.$store.commit('setHospitalDlid', response.data.APPID);

        sessionStorage.setItem('hosName', `${response.data.hosName}`);
        sessionStorage.setItem('APPID', `${response.data.APPID}`);

        console.log(`---------- 医院名称: ${sessionStorage.getItem('hosName')}`);
        console.log(`---------- 医院APPID: ${sessionStorage.getItem('APPID')}`);

        this.hospitalName = `${response.data.hosName}`;
      }).catch((err) => {
        console.log(JSON.stringify(err));
        console.log('===============================22222222222222222222222222222222222222');
        // window.location.href = `http://${this.hospitalDomain}/medicys/error`;
      });
    },
    getHospitalInfo() {
      axios.post(`https://${this.hospitalDomain}/doctor/WeixinLogin.lg?reqType=OBTAIN&RYBID=${config.APIAPPID}&DATA=${this.hospitalDomain}`).then((response) => {
        if (response.data.RESULT == '514' || response.data.RESULT == '515' || response.data.RESULT == '516') {
          this.$messagebox('提示', `${response.data.RESULTTEXT}`);
        }
        this.$store.commit('setHospitalName', response.data.hosName);
        this.$store.commit('setHospitalDlid', response.data.APPID);

        sessionStorage.setItem('hosName', `${response.data.hosName}`);
        sessionStorage.setItem('APPID', `${response.data.APPID}`);

        console.log(`---------- 医院名称: ${this.$store.state.cookies.hospitalName}`);
        console.log(`---------- 医院APPID: ${this.$store.state.cookies.hospitalDlid}`);

        this.hospitalName = `${response.data.hosName}`;
      }).catch((err) => {
        console.log(JSON.stringify(err));
        window.location.href = `https://${this.hospitalDomain}/nethospital/error`;
      });
    },

  },
};
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
.page
  height 100%
  background #f1f1f1
.defTemp
  height:100%
</style>
